<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class postRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'post_title'  => 'required|string',
            'category_id'  => 'required|string',
            'post_date' => 'nullable|date',
            'post_sort' => 'nullable|numeric',
        ];
    }

    public function messages()
    {
        return [
            'post_title.required'  => '文章标题必填！',
            'category_id.required'  => '请选择分类！',
        ];
    }
}
